package weather_service.weatherprovider;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

/**
 * Bean used to hold configuration information for WeatherGateway.
 * <p/>
 */
public class DefaultWeatherConfigurationBean implements WeatherConfigurationIF {
  //:::::::::::::::::::::::::::::::::::::::::::::::
  // constants
  //:::::::::::::::::::::::::::::::::::::::::::::::
  public static final String defaultWeatherServer = "http://xoap.weather.com/";  

  //:::::::::::::::::::::::::::::::::::::::::::::::
  // data members
  //:::::::::::::::::::::::::::::::::::::::::::::::
  private String weatherServer = defaultWeatherServer;
  private String partnerID = "";
  private String licenseKey = "";
  private boolean metricSystem = false;


  public DefaultWeatherConfigurationBean() {
  }

  public DefaultWeatherConfigurationBean(String weatherServer, String partnerID,
                                         String licenseKey) {
    this(weatherServer, partnerID, licenseKey, false);
  }

  public DefaultWeatherConfigurationBean(String weatherServer, String partnerID,
                                         String licenseKey, boolean isMetric) {
    this.weatherServer = weatherServer;
    this.partnerID = partnerID;
    this.licenseKey = licenseKey;
    this.metricSystem = isMetric;
  }

  public String getLicenseKey() {
    return licenseKey;
  }

  public String getPartnerID() {
    return partnerID;
  }

  public String getWeatherServer() {
    return weatherServer;
  }

  public boolean isMetric() {
    return metricSystem;
  }

  public String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
  }

}

